package cn.itcast.bos.dao.base;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.base.Standard;
														//实体类，主键
public interface StandardRepository extends JpaRepository<Standard, Integer>{
	
	List<Standard> findByName(String name);
	/*List<Standard> findByNameLike(String name);
	List<Standard> findByNameAndId(String name);
	List<Standard> findByNameOrId(String name);*/
	
	@Query(value="from Standard where name = ?",nativeQuery=false)
	//nativeQuery false为JPQL, true SQL
	List<Standard> queryName(String n,String n2);
	
	@Query
	List<Standard> queryName2(String name);
	
	@Query(value="update Standard set minLength = ?2 where id = ?1",nativeQuery=false)
	@Modifying	//次注解支持DML
	void updateMinLength(Integer id, Integer minLength);
	
}
